package com.qq.connect;

import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;

public class Conn {
	public static XMPPConnection con = null;

	static void openConnetion() {
		try {
			ConnectionConfiguration connConfig = new ConnectionConfiguration(
					"192.168.80.196", 5222);
			con = new XMPPConnection(connConfig);
			con.connect();
		} catch (XMPPException xe) {
			xe.printStackTrace();
		}
	}

	public static XMPPConnection getConnection() {
		if (con == null) {
			openConnetion();
		}
		return con;
	}

	public static void closeConnetion() {
		con.disconnect();
		con = null;
	}

}
